import { createSSRApp } from 'vue'
import App from './App.vue'
// import pinia from '@/store/index'
import { createPinia } from 'pinia'

import { setupRouter } from '@/router' // 引入路由
import Vant from 'vant'
import 'vant/lib/index.css'
import 'virtual:svg-icons-register' // 注册svg图标
import TabBar from '@/components/TabBar' // 公共的tabs
import NavBar from '@/components/NavBar' // 公共的navbar
import AvantForm from '@/components/AvantForm' // 封装的vant表单
import AvanImg from '@/components/AvanImg' // 公共的图片上传
import AvanRec from '@/components/AvanRec' // 封装递归组件
import AvanList from '@/components/AvanList' // 封装的列表加载
import AvanDialog from '@/components/AvanDialog'
import AvanUploadFile from '@/components/AvanUploadFile' // 公共的文件上传
import { menuTabs, toCaseImg } from '@/utils/index'
import SvgIcon from '@/components/SvgIcon'
import validator from '@/utils/validator'
// var vConsole = new VConsole(); // 开启vconsole
export function createApp() {
	// 创建
	const pinia = createPinia()
	const app = createSSRApp(App)
	setupRouter(app)
	// 全局组件挂载
	// 自定义工具函数
	app.config.globalProperties.menuTabs = menuTabs
	app.config.globalProperties.toCaseImg = toCaseImg
	app.config.globalProperties.validator = validator
	// 自定义ui组件
	app.component('TabBar', TabBar)
	app.component('NavBar', NavBar)
	app.component('AvantForm', AvantForm)
	app.component('AvanImg', AvanImg)
	app.component('AvanUploadFile', AvanUploadFile)
	app.component('AvanRec', AvanRec)
	app.component('AvanList', AvanList)
	app.component('AvanDialog', AvanDialog)
	app.component('SvgIcon', SvgIcon)
	app.use(Vant).use(pinia)
	return {
		app,
	}
}
